-
-
Notifications
You must be signed in to change notification settings - Fork 606
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lower _d_arraycast to object.__ArrayCast #8531
Conversation
Thanks for your pull request, @JinShil! Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub fetch digger
dub run digger -- build "master + dmd#8531" |
|
||
// lower to `object.__ArrayCast!(TFrom, TTo)(from)` | ||
|
||
auto id = Identifier.idPool("__ArrayCast"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How can I fully qualify this to object.__ArrayCast
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look at how the comparison lowering is done to __cmp
.
Lines 9794 to 9798 in 03e7693
// Lower to object.__cmp(e1, e2) | |
Expression al = new IdentifierExp(exp.loc, Id.empty); | |
al = new DotIdExp(exp.loc, al, Id.object); | |
al = new DotIdExp(exp.loc, al, Id.__cmp); | |
al = al.expressionSemantic(sc); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I need an Identifer
, not an Expression
, for the TemplateInstance
, later. How do I create a fully-qualified Identifier
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do I create a fully-qualified Identifier?
I don't think that is possible. To get the fully qualified name inside the compiler one needs to walk up the parent chain and build up the name that way. In your case, I think you need to use the overload of the TemplateInstance
constructor that takes a TemplateDeclaration
. Perhaps you can store the TemplateDeclaration
when it's analyzed in the same way as the Object
class declaration (and others) is stored:
Lines 367 to 372 in 03e7693
if (id == Id.Object) | |
{ | |
if (!inObject) | |
error("%s", msg); | |
object = this; | |
} |
|
||
// size mismatch, should result in an assertion failure | ||
l = cast(long[])b; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing newline
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
Requires dlang/druntime#2264 to be merged first